package com.wowangz.cms.user.service;

import java.util.List;

import com.wowangz.cms.syscore.exception.ServiceException;
import com.wowangz.cms.syscore.service.BaseService;
import com.wowangz.cms.user.pojo.Language;
import com.wowangz.cms.user.pojo.User;

public class LoginService extends BaseService {

	public User findUserByLoginName(User loginUser) throws ServiceException {
		User user;
		try {
			user = this.getSqlSession().selectOne("Login.findUserByLoginName", loginUser);
		} catch (Exception e) {
			e.printStackTrace();
			throw new ServiceException(e.getMessage());
		}
		return user;
	}

	public List<Language> getlanguageList() throws ServiceException {
		List<Language> list;
		try {
			list = this.getSqlSession().selectList("Login.getlanguageList");
		} catch (Exception e) {
			e.printStackTrace();
			throw new ServiceException(e.getMessage());
		}

		return list;
	}

	/**
	 * @描述：更新了用户的数据
	 * @author HUANGYUAN
	 * @TIME:2015年8月31日 上午10:03:31
	 * @param user
	 * @throws ServiceException
	 */
	public void updateUserByLoginName(User user) throws ServiceException {

		try {
			this.getSqlSession().update("Login.updateUserByLoginName", user);
		} catch (ServiceException e) {
			e.printStackTrace();
			throw new ServiceException(e.getMessage());
		}

	}
}
